package userserv

import (
	"codedef"
	"log"
	"message"
	"net/http"
)

func onSetReadMsg(w http.ResponseWriter, r *http.Request) {
	var account string
	account = r.Header.Get("account")

	log.Printf("onSetReadMsg, account:%s\n", account)

	id := r.URL.Query().Get("id")
	if id == "" {
		replyError(w, codedef.ERR_DECODE)
		return
	}

	message.SetMessageRead(account, []string{id})

	w.WriteHeader(200)
}

func init() {
	myMux.muxHandlers.HandleFunc("/setReadMsg", onSetReadMsg)
}
